home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 429_01 / chess12 / uplayer.cpp < prev    next >
C/C++ Source or Header  |  1994-03-30  |  576b  |  28 lines

  1. #include "chess.hpp"
  2. #include "uplayer.hpp"
  3. #include "chessui.hpp"
  4.  
  5. GAMESTATUS USERPLAYER::play(BOARD &board) const
  6.   {
  7.     BOARDMETRIC metric;
  8.  
  9.     board.findBestMoves(2, whatColor(), metric, (BESTMOVES *) 0);
  10.     switch (metric.kingSituation[whatColor()])
  11.       {
  12.       case KINGLOST:
  13.     ChessUI.mated(whatColor());
  14.     return(GAMEOVER);
  15.  
  16.       case STALEMATE:
  17.     ChessUI.staleMated(whatColor());
  18.     return(GAMEOVER);
  19.  
  20.       case KINGOK:
  21.     break;
  22.       }
  23.  
  24.     if (!ChessUI.userMove(board, whatColor()))
  25.       return(GAMEOVER);
  26.     return(GAMECONTINUE);
  27.   }
  28.